package com.leyou.web;

import com.leyou.web.service.IPageService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;

import java.util.Map;

/**
 * 处理请求和响应的方法
 *
 * @version V1.0
 * @package com.leyou.web
 * @description:
 * @author: pc
 * @date: 2019/7/3 19:48
 */
@Controller
public class PageController {

    @Autowired
    private IPageService pageService;

    @GetMapping("/item/{id}.html")
    public String toItemHtml(@PathVariable("id") Long spuId, Model model) {
        Map<String,Object> map = pageService.loadItemData(spuId);
        model.addAllAttributes(map);
        return "item";
    }
}
